package com.itheima.controller;


import com.itheima.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/ajax")
public class AjaxController {
    /**
     * ajax携带数据
     * ①单个携带数据
     * ②携带json数据需要声明文档类型  contentType:"application/json;charset=utf-8"
     * ③携带key=value类型数据  不需要转化json数据
     *
     */
    @RequestMapping("/test01")
    @ResponseBody
    public String test01(String username){
        return username;
    }

    @RequestMapping("/test02")
    @ResponseBody
    public User test02( User user){
        System.out.println(user);
        return user ;
    }

    @RequestMapping("/test03")
    @ResponseBody
    public User test03( User user){
        System.out.println(user);
        return user ;
    }
}
